package mirrormonkey.state.tools.state.entities;

import mirrormonkey.core.annotations.ClientSideConstructor;
import mirrormonkey.core.annotations.EntityHierarchy;
import mirrormonkey.framework.entity.EntityData;
import mirrormonkey.framework.entity.SyncEntity;
import mirrormonkey.state.AnnotationPresets.ServerToClient;
import mirrormonkey.state.annotations.TrackValue;

import com.jme3.math.Quaternion;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;

@EntityHierarchy
public class StateSyncBox extends Geometry implements SyncEntity {

	public EntityData data;

	@ServerToClient
	public int intField = 0;

	@ServerToClient
	public Object obj;

	@ServerToClient
	@TrackValue(true)
	public Object trackedObj;

	public int setterCalls = 0;

	public int objSetterCalls = 0;

	@ClientSideConstructor
	public StateSyncBox() {
		super("Box", new Box(Vector3f.ZERO, 0.5f, 0.5f, 0.5f));
	}

	public void setTrackedObj(Object obj) {
		objSetterCalls++;
		trackedObj = obj;
	}

	@Override
	@ServerToClient
	public void setLocalTranslation(Vector3f localTranslation) {
		super.setLocalTranslation(localTranslation);
	}

	@Override
	public Vector3f getLocalTranslation() {
		return super.getLocalTranslation();
	}

	@Override
	@TrackValue(true)
	@ServerToClient
	public void setLocalRotation(Quaternion rot) {
		setterCalls++;
		super.setLocalRotation(rot);
	}

	@Override
	public Quaternion getLocalRotation() {
		return super.getLocalRotation();
	}

	@Override
	public void setData(EntityData data) {
		this.data = data;
	}

	@Override
	public EntityData getData() {
		return data;
	}

	public void resetFlag() {
		objSetterCalls = 0;
		setterCalls = 0;
	}

}
